public class FindMinDiff{

	int findMinDiff(int[] A){
		int comp1=0, comp2=0;
		int n = A.length;
		if(n == 0)
		{
			System.out.println("The array is empty");
			return -1;
		}
		int min = mod(A[0],A[1]);
		for(int i = 0; i < n-1; i++)
		{
		
			for(int j = i+1; j<n; j++)
			{
				if(mod(A[j],A[i]) < min)
					min = mod(A[j],A[i]);
				
			}

		}

		

		return min;

	}

	int mod(int x, int y)
	{
		return (x>y)?(x-y):(y-x);
	}

	public static void main(String[] args) {
		int[] A = {2,-1,-8,1,8,9,10,75,46,43};
		FindMinDiff x = new FindMinDiff();
		System.out.println("The least difference is: "+ x.findMinDiff(A));
	}
}